package com.gzz.orchid.context.application.rbac.impl;


import com.gzz.orchid.common.core.tuple.TreeNode;
import com.gzz.orchid.context.application.rbac.IOrganizationHandler;
import com.gzz.orchid.context.application.rbac.pojo.OrganizationDto;
import com.gzz.orchid.context.application.rbac.pojo.OrganizationVo;
import com.gzz.orchid.context.application.rbac.queries.OrganizationQuery;
import com.gzz.orchid.context.infrastructure.persistence.mapper.sys.SysOrganizationMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author higmd
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class OrganizationHandler implements IOrganizationHandler {
    private final SysOrganizationMapper mapper;

    @Override
    public List<OrganizationDto> listByPager(OrganizationQuery query) {
//        QueryWrapper queryWrapper = new QueryWrapper();
//        return mapper.paginateAs(1, 100
//                , queryWrapper, OrganizationDto.class);
        return null;
    }

    @Override
    public List<OrganizationDto> list(OrganizationQuery query) {
//        List<SysOrganizationPo> organizationPos = mapper.selectAll();
//        return RbacAssembler.mapOrganizationTreeDto(organizationPos, 0L);
        return null;
    }

    @Override
    public OrganizationVo detail(Long id) {
//        SysOrganizationPo po = mapper.selectOneById(id);
//        return Optional.ofNullable(po)
//                .map(OrganizationConverter.INSTANCE::mapVo)
//                .orElse(null);
        return null;
    }

    @Override
    public List<TreeNode<Long>> options() {
//        List<SysOrganizationPo> organizationPos = mapper.selectAll();
//        return RbacAssembler
//                .mapOrganizationTreeOptions(organizationPos, 0L);
        return null;
    }
}
